import records

from apis.crud.sqloperate import SqlOperate
from . import table
from flask import jsonify
from apis.crud.dbconnection import operation


@table.route('list')
def table_list():
    result = operation('select * from domain_info')
    total = operation('select count(*) as total from domain_info',multi=True)
    total = total.get('total')
    data = {'code': 20000,
            'message': '',
            'data':
                {'total': total,
                 'items': result}
            }
    return jsonify(data)
